package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

func main() {
	sc := bufio.NewScanner(os.Stdin)
	sc.Scan()
	ns := strings.Split(sc.Text(), " ")[0]
	n, _ := strconv.Atoi(ns)

	lines := make([]string, n)

	for i := 0; i < n; i++ {
		sc.Scan()
		lines[i] = sc.Text()
	}
	f(lines)
}

func f(lines []string) {
	n := len(lines)

	if n == 1 {
		fmt.Println(lines[0])
		return
	}
	if n%2 != 0 {
		for i := 0; i < n; i++ {
			fmt.Println(lines[i])
		}
		return
	}

	var flag bool
	for n > 1 {
		flag = false
		for i := 0; i < n/2; i++ {
			if lines[i] != lines[n-i-1] {
				flag = true
				break
			}
		}

		if flag {
			break
		}
		n /= 2
	}

	for i := 0; i < n; i++ {
		fmt.Println(lines[i])
	}
}
